﻿@{
    ViewBag.Title = "ChangePassWord";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml.cshtml";
}
@section head{
    <link href="@Url.Content("~/Js/Validform_v5.3.2/css/style.css")" rel="stylesheet" type="text/css" />
}
<form  id="form1" action="@Url.Action("ChangePassWord")" method="post" name="form1">
<div class="rightbar">
    <p class="righttit">
        <span id="updateTitle">修改管理员密码</span></p>
    <div class="rightshow">
        <table width="80%" border="0" cellspacing="0" cellpadding="0" class="m20 edittable">
            <tr>
                <th width="7%" height="34">
                    <p>
                        旧密码：</p>
                </th>
                <td colspan="2">
                    <input type="password" value="" id="txtOldpwd" name="txtOldpwd" class="txt" datatype="*6-16"
                        nullmsg="请输入旧密码！" errormsg="旧密码范围在6~16位之间！" />
                    <span class="Validform_checktip"></span>
                </td>
            </tr>
            <tr>
                <th width="7%" height="34">
                    <p>
                        新密码：</p>
                </th>
                <td colspan="2">
                    <input type="password" value="" id="txtNewpwd" name="txtNewpwd" class="txt" datatype="*6-16"
                        nullmsg="请输入新密码！" errormsg="新密码范围在6~16位之间！" />
                    <span class="Validform_checktip"></span>
                </td>
            </tr>
            <tr>
                <th width="7%" height="34">
                    <p>
                        确认密码：</p>
                </th>
                <td colspan="2">
                    <input type="password" value="" id="txtNewpwd2" name="txtNewpwd2" class="txt" datatype="*"
                        recheck="txtNewpwd" nullmsg="请再输入一次密码！" errormsg="您两次输入的密码不一致！" />
                    <span class="Validform_checktip"></span>
                </td>
            </tr>
            <tr>
                <td width="10%">
                    <a href="###" id="btnSubmit" class="sbtn1"><span class="white">确定</span></a>
                </td>
                <td width="83%">
                    <a href="javascript:history.go(-1);" class="sbtn2"><span class="white">取消</span></a>
                </td>
            </tr>
        </table>
    </div>
</div>
</form>
@section Script{
    <script src="@Url.Content("~/Js/Validform_v5.3.2/js/Validform_v5.3.2_min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Js/artDialog/artDialog.js")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Js/artDialog/jquery.artDialog.source.js")" type="text/javascript"></script>
    <script type="text/javascript">
 $(function () {
  //提交验证 
  var formSubmit = $("#form1").Validform({
     btnSubmit: "#btnSubmit", 
     tiptype: function (msg, o, cssctl) { 
    //msg：提示信息; 
    //o:{obj:*,type:*,curform:*},obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态,curform为当前form对象; 
     //cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
    if (!o.obj.is("form")) {//验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象; 
    var objtip= o.obj.siblings(".Validform_checktip"); cssctl(objtip, o.type);
     objtip.text(msg);
    }
     else 
     { var objtip = o.obj.find("#msgdemo"); 
     cssctl(objtip, o.type); 
     objtip.text(msg);
      }
    },
     ajaxPost: true,
      showAllError: true,
       beforeSubmit: function () {
        //在验证成功后，表单提交前执行的函数，curform参数是当前表单对象。
       //这里明确return false的话表单将不会提交; 
       }, callback: function (data) { 
       //data是object类型 
       if (data== "1") { 
       //window.location.href = "/Admin/AdminMgr/AdminList";
        jQuery.dialogHelper.alert("保存成功","success", "ok"); }
         else if (data == "0") { 
         // art.dialog({ // title: "提示", // icon:"warning", // content: "操作失败！", // time: 2 // }); 
         jQuery.dialogHelper.alert("请核对旧密码,请稍后再试！","alert"); }
          // else { // art.dialog({ // title: "提示", // icon: "warning", // content:"操作失败，该用户已经存在！", // time: 2 // }); // } //
         } 
         
          });
//执行成功后刷新页面
 function ok() {
  location.href = "/Areas/Admin/Home/ChangePassWord";
   $.dialogHelper.close();
}
    </script>
}
